﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Suteki.Common.Repositories;
using BulletOnRails4NET.Models;

namespace ClubDataRegister.Models.logical
{
    public class ClubRepositoryFactory : RepositoryFactory
    {
        public ClubsDataRepository ClubDataRep {get; set;}

        public ClubRepositoryFactory()
        {
        }

        public void InitializeClubDataRepository()
        {
            ClubDataRep = ClubsDataRepository.GetInstance();
        }

        public void InitializeDataContext()
        {
            RepositoryDataContext = ClubDataRep.db;
        }
        
        /// <summary>
        /// Needs to be called after the DataContext has been initialized
        /// </summary>
        public void InitializeGenericRepositories()
        {
            Repositories = new Dictionary<string, IRepository>();
            //To be customized for every app
            Repositories.Add("Attendance", new Repository<Attendance>());
            Repositories.Add("Award", new Repository<Award>());
            Repositories.Add("GivenAward", new Repository<GivenAward>());
            Repositories.Add("Clubber", new Repository<Clubber>());
            Repositories.Add("Leader", new Repository<Leader>());
            Repositories.Add("LeaderAttendance", new Repository<LeaderAttendance>());
            Repositories.Add("Team", new Repository<Team>());
            Repositories.Add("TeamType", new Repository<TeamType>());
        }
    }
}
